package Service;

import Dao.TeacherDao;
import Interface.TeacherServiceInterface;
import org.example.Teacher;
import util.Condition;
import util.JdbcHelper;
import util.Pagination;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;

public class TeacherService implements TeacherServiceInterface {
    static TeacherService teacherService = null;
    static TeacherDao teacherDao = new TeacherDao();

    public static TeacherService getInstance(){
        if (teacherService == null){
            teacherService = new TeacherService();
        }
        return teacherService;
    }

    private  TeacherService(){}



    @Override
    public Teacher add(Teacher teacher) throws SQLException {
        teacher = teacherDao.add(teacher);
        return teacher;
    }
    @Override
    public Teacher update(Teacher teacher) throws SQLException {
        teacher = teacherDao.update(teacher);
        return teacher;
    }
    @Override
    public Teacher delete(Teacher teacher) throws SQLException {
        teacher = teacherDao.delete(teacher);
        return teacher;
    }

    @Override
    public Collection<Teacher> findAll(List<Condition> conditionList, Pagination pagination) throws SQLException {
        return null;
    }

    @Override
    public Teacher find(int id) throws SQLException {
        Teacher teacher = teacherDao.find(id);
        return teacher;
    }
}
